<template>
  <div class="apply">
    <!-- 头部 -->
    <div class="height">
      <h5 @click="$router.back()">旅游攻略</h5>
      <span>/</span>
      <div>攻略详情</div>
    </div>
    <div class="title">
      <h2>{{ articleData.title }}</h2>
    </div>
    <div class="introduce">
      攻略: <span>{{ articleData | dateForm }}</span> <span>阅读：</span
      ><span>{{ articleData.watch }}</span>
    </div>
    <div v-html="articleData.content"></div>
    <!-- 评论和分享模块 -->
    <div class="comment">
      <div class="left">
        <div class="el-icon-edit-outline"></div>
        <div class="dis">评论({{ $store.state.comment.comment }})</div>
      </div>
      <div class="right">
        <div class="el-icon-share"></div>
        <div>分享</div>
      </div>
    </div>
  </div>
</template>

<script>
import moment from "moment";
export default {
  data() {
    return {
      articleData: [], // 请求回来的数据
    };
  },
  mounted() {
    this.$axios({
      url: "posts",
      params: { id: this.$route.query.id },
    }).then((res) => {
      this.articleData = res.data.data[0];
    });
  },
  // 处理时间
  filters: {
    dateForm(el) {
      return moment(el).format("YYYY-MM-DD HH:mm");
    },
  },
};
</script>

<style lang="less" scoped>
.apply {
  margin-right: 30px;
}
.height {
  display: flex;
  span {
    margin: 0 10px;
    font-size: 14px;
  }
  div {
    font-size: 14px;
    color: #666;
  }
}
.title {
  h2 {
    padding: 20px 0;
    height: 50px;
    border-bottom: 1px solid #ccc;
  }
}
.introduce {
  margin-left: 430px;
  padding: 20px 0;
  color: #888;
  font-size: 14px;
  span {
    margin-right: 5px;
  }
}
/deep/ p {
  padding: 10px 0;
  img {
    height: 400px;
    width: 100%;
  }
  span {
    height: 500px;
    color: #eee;
    font-size: 12px;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.comment {
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  .right,
  .left {
    color: #888;
    font-size: 14px;
    width: 100px;
  }
  .dis {
    margin-left: -13px;
  }

  .el-icon-share,
  .el-icon-edit-outline {
    color: orange;
    font-size: 30px;
    .left {
    }
  }
}
</style>